-
Notifications
You must be signed in to change notification settings - Fork 69
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Display Link as payment method on order received page with setup intents #8764
Conversation
Test the buildOption 1. Jetpack Beta
Option 2. Jurassic Ninja - available for logged-in A12s🚀 Launch a JN site with this branch 🚀 ℹ️ Install this Tampermonkey script to get more options. Build info:
Note: the build is updated when a new commit is pushed to this PR. |
Size Change: 0 B Total Size: 1.25 MB ℹ️ View Unchanged
|
$payment_method_id = isset( $_POST['payment_method_id'] ) ? wc_clean( wp_unslash( $_POST['payment_method_id'] ) ) : ''; | ||
if ( 'null' === $payment_method_id ) { | ||
$payment_method_id = ''; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
update_order_status()
is used to update 3DS orders after authentication. Shortcode checkout includes payment_method_id
in the update_order_status()
AJAX request for setup intents but blocks checkout doesn't. This payment method is only used in adding the token to the user. We need the token to determine the payment method type in order to correctly set the payment method title. This is all to say that we can safely remove this as it's now being set below, pulled from the intent.
Incidentally, this might solve #8611 but I haven't had a chance to verify that yet.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Battled through figuring out default behavior for Link (in general), but I can confirm that this PR displays "Link" as the payment method on the order confirmation page when using a Link CC.
Fixes #8122
Changes proposed in this Pull Request
This PR ensures that Link, rather than Credit / Debit Card, is displayed as the payment method on the order received page for Link orders using setup intents. The problem is that the payment method type,
card
orlink
, is pulled from thepayment_method_details
object within the intent. Setup intents don't containpayment_method_details
so the payment method type is pulled frompayment_method_options
, which only containscard
. To get around this, we can look at the token and determine if it's a Link token and set the payment method type accordingly.Testing instructions
This specifically deals with setup intents so assume all orders should be setup intents, such as a subscription with a free trial.
Repeat the following steps on Shortcode and Blocks checkouts:
npm run changelog
to add a changelog file, choosepatch
to leave it empty if the change is not significant. You can add multiple changelog files in one PR by running this command a few times.Post merge